package com.sjx.boundarycallback.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.sjx.boundarycallback.R;

/**
 * Created by sjx on 6/16/22
 * 自动文本框页面（从数据库中取出候选词条信息再进行筛选）
 */
public class AutoTextFragment extends Fragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_first, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.item_search_suggest, COUNTRIES);
        AutoCompleteTextView textView = (AutoCompleteTextView)
                view.findViewById(R.id.tv_select);
        textView.setAdapter(adapter);
    }

    private static final String[] COUNTRIES = new String[] {
            "Belgium", "France", "Italy", "Germany", "Spain", "FEIWU", "FEIFEIFEI"
    };

}
